package com.vincce.fitness.core.util;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

import java.io.IOException;

/**
 * Created by Administrator on 2014/11/27.
 */

public class EndecodeUtil {

	/**
	 * 简单的加密
	 * @param code
	 * @return
	 */
	public static String encode(String code){
		BASE64Encoder  encoder = new BASE64Encoder();
		return encoder.encode(code.getBytes());
	}

	/**
	 * 简单的解密
	 * @param code
	 * @return
	 */
	public static String decode(String code){
		BASE64Decoder decoder = new BASE64Decoder();
		String ss=null;
		try {
			ss = new String(decoder.decodeBuffer(code));
		} catch (IOException e) {
			e.printStackTrace();
		}
		return ss;
	}
}
